const Moment = require('moment')

exports.now = function (format = 'YYYY-MM-DD HH:mm:ss') {
  return Moment().format(format)
}
exports.getExpire = function (expireTime, offset = 0, format = 'YYYY-MM-DD HH:mm:ss') {
  let now = Moment()

  return now.add(expireTime - offset, 'ms').format(format)
}
exports.expire = function (startTime, expireTime, format = 'YYYY-MM-DD HH:mm:ss') {
  let now = Moment()

  return now.diff(Moment(startTime, format), 'seconds') > expireTime
}
